# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import sys

from PyQt5.QtGui import QPixmap,QIcon,QPalette,QColor
from PyQt5.QtWidgets import QApplication, QLayout
from spreadsheet import SpreadSheet
import getpath
import qss_rc
def qingyun_style(a):
    # f=open("qss/lightblue.css", "r") 
    # f=open("qss/blacksoft.css", "r") 
    f=open(os.path.join(getpath.getpath(),"qss","blacksoft.css"), "r") 
    _style = f.read()
    # print(_style)
    paletteColor=_style[20:20+7]
    # print(paletteColor)
    a.setPalette(QPalette(QColor(paletteColor)));
    a.setStyleSheet(_style);
if __name__ == "__main__":
    import sys
    import os
    import logging
    import getpath
    initpath=getpath.getpath()
    import logging
    from logging.handlers import RotatingFileHandler
    handlers=[RotatingFileHandler(filename="report.log", maxBytes=10*1024*1024, encoding='utf-8',backupCount=3)
    ,logging.StreamHandler(sys.stdout)]
    logging.basicConfig(level=logging.DEBUG,
                        format = '%(asctime)s - %(name)s - %(levelname)s -%(funcName)s - %(message)s',
                        handlers=handlers)
    logging.info('begin')
    app = QApplication([])
    qingyun_style(app)
    sheet = SpreadSheet(10, 6)
    # sheet.setWindowIcon(QIcon(QPixmap(":/images/interview.png")))
    sheet.resize(1000,800)
    sheet.show()
    # sheet.layout().setSizeConstraint(QLayout.SetFixedSize)

    sys.exit(app.exec())
